<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.1</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="__ADMIN__/css/font.css">
    <link rel="stylesheet" href="__ADMIN__/css/xadmin.css">
    <script type="text/javascript" src="__ADMIN__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__ADMIN__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__ADMIN__/js/xadmin.js"></script>
    <script type="text/javascript" src="__ADMIN__/js/cookie.js"></script>
    <style>
        .layui-form-item .layui-form-checkbox[lay-skin=primary]{
            margin-top: 0;
        }
    </style>
</head>

<body>
<div class="x-body x-admin">
    <form class="layui-form">
        <input type="hidden" name="level" value="{:input()['level']}">

        <div class="layui-form-item">
            <label for="title" class="layui-form-label">
                <span class="x-red">*</span>考核名称
            </label>
            <div class="layui-input-inline">
                <input type="text" value="{$data.title}" id="title" name="title" lay-verify="required" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-inline">
            <label class="layui-form-label">考核日期选择</label>
            <div class="layui-input-inline">
                <input type="text" name="start_date" id="start_date" value="{if condition="input('start_date')"}{:input('start_date')}{/if}" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label>至</label>
            <div class="layui-input-inline">
                <input type="text" name="end_date" id="end_date" value="{if condition="input('end_date')"}{:input('end_date')}{/if}" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label for="username" class="layui-form-label">
                选择考核人员
            </label>

            <div class="layui-table-body layui-table-main">
                <table class="layui-table layui-form">
                    <tbody>

                        <!--<tr>-->
                            <!--<td>-->
                                <!--<div class="header layui-form-checkbox" lay-skin="primary" data-id=""><i class="layui-icon">&#xe605;</i></div>-->
                                <!--<span class="text" style="">全选</span>-->
                            <!--</td>-->
                        <!--</tr>-->

                        <tr>
                            {volist name="admin_list" key="key" id="value"}

                            {if condition="$key % 3 == 0"}
                        </tr>
                        <tr>
                            {/if}

                            <td class="check-td">
                                <div class="layui-form-checkbox" id="admin" name="admin" lay-skin="primary" data-id="a*{$value.id}"><i class="layui-icon">&#xe605;</i></div>
                                <span class="text" style="">{$value.name}</span>
                            </td>

                            {/volist}
                        </tr>

                    </tbody>
                </table>
            </div>

            <label for="username" class="layui-form-label">
                栏目
            </label>

            <div class="layui-table-body layui-table-main">
                <table class="layui-table layui-form">
                    <tbody>

                    <!--<tr>-->
                        <!--<td>-->
                            <!--<div class="header layui-form-checkbox" lay-skin="primary" data-id=""><i class="layui-icon">&#xe605;</i></div>-->
                            <!--<span class="text" style="">全选</span>-->
                        <!--</td>-->
                    <!--</tr>-->

                    <tr>
                    {volist name="kpi_column_list" key="key" id="value"}

                        {if condition="$key % 3 == 0"}
                            </tr>
                            <tr>
                        {/if}

                        <td class="check-td">
                            <div class="layui-form-checkbox" id="column" name="column" lay-skin="primary" data-id="{$value.id}"><i class="layui-icon">&#xe605;</i></div>
                            <span class="text" style="">{$value.title}</span>
                        </td>

                    {/volist}
                    </tr>

                    </tbody>
                </table>
            </div>

            <label for="username" class="layui-form-label">
                栏目内容
            </label>

            <div class="layui-table-body layui-table-main">
                <table class="layui-table layui-form">
                    <tbody>

                    <tr>
                    {volist name="kpi_exam_content_list" key="key" id="value"}
                        {if condition="$key % 3 == 0"}
                            </tr>
                            <tr>
                        {/if}

                        <td class="check-td">
                            <div class="layui-form-checkbox" id="content" name="content" lay-skin="primary" data-id="c-{$value.id}"><i class="layui-icon">&#xe605;</i></div>
                            <span class="text" style="">{$value.content}</span>
                        </td>

                    {/volist}
                    </tr>

                    </tbody>
                </table>
            </div>

        </div>

        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <button  class="layui-btn" lay-filter="add" lay-submit="">
                确定新增
            </button>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer','laydate'], function(){
        $ = layui.jquery;
        var form = layui.form
                ,layer = layui.layer
                ,laydate = layui.laydate;

        /*$('.check-td').click(function(){
         var child = $(this).children('.layui-form-checkbox');
         child.trigger('click');return
         if(child.hasClass('layui-form-checked'))
         child.removeClass('layui-form-checked');
         else
         child.addClass('layui-form-checked');
         })*/


        //监听提交
        form.on('submit(add)', function(data){
            var column = tableCheck.getData('column');
            var title = data.field.title;
            var start_date = data.field.start_date;
            var end_date = data.field.end_date;

            $.ajax({
                type:'POST',
                dataType:'json',
                data:{column:column,title:title,start_date:start_date,end_date:end_date},
                url:"{:url('kpi/administrationAdd')}",
                success:function(obj){
                    layer.alert(obj.msg, {icon: obj.icon},function(){
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        // 可以对父窗口进行刷新
                        x_admin_father_reload();
                    });
                }
            });
            return false;
        });

        laydate.render({
            elem: '#start_date'
        });
        laydate.render({
            elem: '#end_date'
        });


    });
</script>
</body>

</html>